

package com.zlp.mall.log;

import com.zlp.mall.log.aspect.SysLogAspect;
import com.zlp.mall.log.event.SysLogListener;
import com.zlp.mall.upms.api.feign.FeignOperLogService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

import javax.annotation.Resource;

/**
 * @author lengleng
 * @date 2019/2/1 日志自动配置
 */
@EnableAsync
@ConditionalOnWebApplication
@Configuration(proxyBeanMethods = false)
public class LogAutoConfiguration {

	@Resource
	private FeignOperLogService feignOperatingLogService;

	@Bean
	public SysLogListener sysLogListener() {
		return new SysLogListener(feignOperatingLogService);
	}

	@Bean
	public SysLogAspect sysLogAspect() {
		return new SysLogAspect();
	}

}
